package com.pzj.dormitory.controller;


import com.pzj.dormitory.form.SearchForm;
import com.pzj.dormitory.mapper.StudentMapper;
import com.pzj.dormitory.service.impl.MoveoutServiceImpl;
import com.pzj.dormitory.service.impl.StudentServiceImpl;
import com.pzj.dormitory.util.ResultVOUtil;
import com.pzj.dormitory.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author admin
 * @since 2024-04-28
 */
@RestController
@RequestMapping("/moveout")
public class MoveoutController {

    @Autowired
    private MoveoutServiceImpl moveoutService;


    @GetMapping("/list/{pageNum}/{pageSize}")
    public ResultVO list(@PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize) {
        return ResultVOUtil.success(moveoutService.list(pageNum, pageSize));
    }

    @GetMapping("/search")
    public ResultVO search(SearchForm searchForm) {
        return ResultVOUtil.success(moveoutService.search(searchForm));
    }

    @PutMapping("/moveout/{id}/{reason}")
    public ResultVO moveout(@PathVariable("id") Integer id, @PathVariable("reason") String reason) {
        return  ResultVOUtil.success(moveoutService.moveout(id, reason));
    }

    @GetMapping("/moveoutList/{pageNum}/{pageSize}")
    public ResultVO moveoutList(@PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize) {
        return ResultVOUtil.success(moveoutService.moveoutList(pageNum, pageSize));
    }

    @GetMapping("/moveoutSearch")
    public ResultVO moveoutSearch(SearchForm searchForm) {
        return ResultVOUtil.success(moveoutService.moveoutSearch(searchForm));
    }

}
